package test.cumulativeProtocol.codec;

import java.nio.charset.Charset;

import org.apache.mina.core.session.IoSession;
import org.apache.mina.filter.codec.ProtocolCodecFactory;
import org.apache.mina.filter.codec.ProtocolDecoder;
import org.apache.mina.filter.codec.ProtocolEncoder;

public class TProtocolCodecFactory implements ProtocolCodecFactory {

  private final TProtocolDecoder decoder;

  private final TProtocolEncoder encoder;

  public TProtocolCodecFactory(Charset charset) {
    this.decoder=new TProtocolDecoder(charset);
    this.encoder=new TProtocolEncoder(charset);
  }

  @Override
  public ProtocolDecoder getDecoder(IoSession paramIoSession) throws Exception {
    return decoder;
  }

  @Override
  public ProtocolEncoder getEncoder(IoSession paramIoSession) throws Exception {
    return encoder;
  }
}
